<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>08_案例练习-通过节点类型将子节点中的子元素节点存到数组中</title>
    </head>
    <body>
        <ul>
            <li>奥赛罗</li>
            <li>哈姆雷特</li>
            <li>麦克白</li>
            <li>李尔王</li>
        </ul>


        <script>
            var ul = document.querySelector('ul');

            var node_list = ul.childNodes;

            var new_arr = [];

            for(var i = 0; i < node_list.length; i++){
                if(node_list[i].nodeType == 1){
                    new_arr.push(node_list[i].innerHTML);
                }
            }

            console.log(new_arr);


        </script>
    </body>
</html>